/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import entity.Reservaciones;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author FRANCO
 */
@Stateless
public class ReservacionesFacade extends AbstractFacade<Reservaciones> implements ReservacionesFacadeRemote {
    @PersistenceContext(unitName = "socafe-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ReservacionesFacade() {
        super(Reservaciones.class);
    }

    @Override
    public int getIdRes() {
        int idReservacion = Integer.parseInt(getEntityManager().createNativeQuery("SELECT LAST_INSERT_ID()").getSingleResult().toString());
        return idReservacion;
    
    }
    
}
